<!-- saved from url=(0014)about:internet -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>myproject.mxml</title>
<link rel="stylesheet" type="text/css" href="../SourceStyles.css"/>
</head>

<body><pre><span class="MXMLProcessing_Instruction">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;</span>
<span class="MXMLComponent_Tag">&lt;mx:Application</span><span class="MXMLDefault_Text"> xmlns:mx=&quot;</span><span class="MXMLString">http://www.adobe.com/2006/mxml</span><span class="MXMLDefault_Text">&quot; layout=&quot;</span><span class="MXMLString">absolute</span><span class="MXMLDefault_Text">&quot; backgroundColor=&quot;</span><span class="MXMLString">white</span><span class="MXMLDefault_Text">&quot; viewSourceURL=&quot;</span><span class="MXMLString">srcview/index.html</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">&gt;</span>    
    
    <span class="MXMLSpecial_Tag">&lt;mx:Script&gt;</span>
        
        <span class="ActionScriptOperator">&lt;!</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">CDATA</span><span class="ActionScriptBracket/Brace">[</span>
        
            <span class="ActionScriptASDoc">/**
             * @author Ryan Gravener
             */</span>
             
            <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">mx</span>.<span class="ActionScriptDefault_Text">events</span>.<span class="ActionScriptDefault_Text">IndexChangedEvent</span>;
            <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">mx</span>.<span class="ActionScriptDefault_Text">core</span>.<span class="ActionScriptDefault_Text">UIComponent</span>;
            <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">mx</span>.<span class="ActionScriptDefault_Text">rpc</span>.<span class="ActionScriptDefault_Text">events</span>.<span class="ActionScriptDefault_Text">ResultEvent</span>;
            <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">org</span>.<span class="ActionScriptDefault_Text">myproject</span>.<span class="ActionScriptDefault_Text">domain</span>.<span class="ActionScriptDefault_Text">Click</span>;
            
            <span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">clickHandler</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">evt</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">MouseEvent</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span> <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">click</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Click</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Click</span><span class="ActionScriptBracket/Brace">()</span>
                <span class="ActionScriptDefault_Text">click</span>.<span class="ActionScriptDefault_Text">x</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">localX</span>;
                <span class="ActionScriptDefault_Text">click</span>.<span class="ActionScriptDefault_Text">y</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">localY</span>;
                <span class="ActionScriptDefault_Text">drawClick</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">me</span>,<span class="ActionScriptDefault_Text">click</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptDefault_Text">clickService</span>.<span class="ActionScriptDefault_Text">saveClick</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">click</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptBracket/Brace">}</span>
            
            <span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">fetchClicks</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">evt</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">ResultEvent</span><span class="ActionScriptOperator">=</span><span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span> <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">evt</span><span class="ActionScriptOperator">==</span><span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span>
                    <span class="ActionScriptDefault_Text">clickService</span>.<span class="ActionScriptDefault_Text">getClicks</span>.<span class="ActionScriptDefault_Text">addEventListener</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">ResultEvent</span>.<span class="ActionScriptDefault_Text">RESULT</span>, <span class="ActionScriptDefault_Text">fetchClicks</span><span class="ActionScriptBracket/Brace">)</span>;
                    <span class="ActionScriptDefault_Text">clickService</span>.<span class="ActionScriptDefault_Text">getClicks</span><span class="ActionScriptBracket/Brace">()</span>;
                <span class="ActionScriptBracket/Brace">}</span> <span class="ActionScriptReserved">else</span> <span class="ActionScriptBracket/Brace">{</span>                    
                    <span class="ActionScriptDefault_Text">everyone</span>.<span class="ActionScriptDefault_Text">graphics</span>.<span class="ActionScriptDefault_Text">clear</span><span class="ActionScriptBracket/Brace">()</span>;
                    <span class="ActionScriptReserved">for</span> <span class="ActionScriptReserved">each</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">click</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Click</span> <span class="ActionScriptReserved">in</span> <span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">result</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span>
                        <span class="ActionScriptDefault_Text">drawClick</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">everyone</span>,<span class="ActionScriptDefault_Text">click</span><span class="ActionScriptBracket/Brace">)</span>;
                    <span class="ActionScriptBracket/Brace">}</span>
                <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptBracket/Brace">}</span>
            
            <span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">checkIndex</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">evt</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">IndexChangedEvent</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span> <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">navigator</span>.<span class="ActionScriptDefault_Text">getChildAt</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">newIndex</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">==</span><span class="ActionScriptDefault_Text">everyone</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span>
                    <span class="ActionScriptDefault_Text">fetchClicks</span><span class="ActionScriptBracket/Brace">()</span>;
                <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptBracket/Brace">}</span>
            
            <span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">drawClick</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">comp</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">UIComponent</span>, <span class="ActionScriptDefault_Text">click</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Click</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span> <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">g</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Graphics</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">comp</span>.<span class="ActionScriptDefault_Text">graphics</span>;
                <span class="ActionScriptDefault_Text">g</span>.<span class="ActionScriptDefault_Text">beginFill</span><span class="ActionScriptBracket/Brace">(</span>0<span class="ActionScriptDefault_Text">xFF8800</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptDefault_Text">g</span>.<span class="ActionScriptDefault_Text">drawCircle</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">click</span>.<span class="ActionScriptDefault_Text">x</span>,<span class="ActionScriptDefault_Text">click</span>.<span class="ActionScriptDefault_Text">y</span>,5<span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptBracket/Brace">}</span>
        <span class="ActionScriptBracket/Brace">]]</span><span class="ActionScriptOperator">&gt;</span>    
    <span class="MXMLSpecial_Tag">&lt;/mx:Script&gt;</span>
    <span class="MXMLComponent_Tag">&lt;mx:VBox</span><span class="MXMLDefault_Text"> width=&quot;</span><span class="MXMLString">100%</span><span class="MXMLDefault_Text">&quot; height=&quot;</span><span class="MXMLString">100%</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">&gt;</span>    
        <span class="MXMLComponent_Tag">&lt;mx:TabNavigator</span><span class="MXMLDefault_Text"> id=&quot;</span><span class="MXMLString">navigator</span><span class="MXMLDefault_Text">&quot; width=&quot;</span><span class="MXMLString">100%</span><span class="MXMLDefault_Text">&quot; height=&quot;</span><span class="MXMLString">100%</span><span class="MXMLDefault_Text">&quot; backgroundColor=&quot;</span><span class="MXMLString">white</span><span class="MXMLDefault_Text">&quot; change=&quot;</span><span class="ActionScriptDefault_Text">checkIndex</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptBracket/Brace">)</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">&gt;</span>
            <span class="MXMLComponent_Tag">&lt;mx:Canvas</span><span class="MXMLDefault_Text"> id=&quot;</span><span class="MXMLString">me</span><span class="MXMLDefault_Text">&quot; label=&quot;</span><span class="MXMLString">Me</span><span class="MXMLDefault_Text">&quot; click=&quot;</span><span class="ActionScriptDefault_Text">clickHandler</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptBracket/Brace">)</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">&gt;</span>                
            <span class="MXMLComponent_Tag">&lt;/mx:Canvas&gt;</span>
            <span class="MXMLComponent_Tag">&lt;mx:Canvas</span><span class="MXMLDefault_Text"> id=&quot;</span><span class="MXMLString">everyone</span><span class="MXMLDefault_Text">&quot; label=&quot;</span><span class="MXMLString">Everyone</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">&gt;</span>
            <span class="MXMLComponent_Tag">&lt;/mx:Canvas&gt;</span>
        <span class="MXMLComponent_Tag">&lt;/mx:TabNavigator&gt;</span>
    <span class="MXMLComponent_Tag">&lt;/mx:VBox&gt;</span> 
    
    <span class="MXMLComponent_Tag">&lt;mx:RemoteObject</span><span class="MXMLDefault_Text"> id=&quot;</span><span class="MXMLString">clickService</span><span class="MXMLDefault_Text">&quot; destination=&quot;</span><span class="MXMLString">clickService</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
<span class="MXMLComponent_Tag">&lt;/mx:Application&gt;</span></pre></body>
</html>
